/*
 * MacIP.hpp
 *
 *  Created on: 22.05.2011
 *      Author: mifodix
 */

#ifndef MACIP_HPP_
#define MACIP_HPP_

#ifndef __cplusplus
#error Need C++-compile to process this file
#endif

#include <stdint.h>
#include <string.h>

#define MAC_SIZE 16
class MacIP
{
private:
	char mac[MAC_SIZE];
	uint32_t ip;
public:
	MacIP();
	MacIP(const char *mac, size_t macSize, uint32_t ip);
	MacIP(const MacIP &copy);
	MacIP &operator=(const MacIP &ob);
	bool operator==(const MacIP &other)
	{
		if (ip == other.ip)
		{
			for (size_t i = 0; i < sizeof(mac); i++)
			{
				if (mac[i] != other.mac[i])
					return false;
			}
			return true;
		}
		return false;
	}
	bool operator==(const char* mac)
	{
		for (size_t i=0; i<sizeof(this->mac); i++)
		{
			if (this->mac[i]!=mac[i])
				return false;
		}
		return true;
	}
	bool operator==(uint32_t ip)
	{
		if (this->ip!=ip) return false;
		return true;
	}
	void SetMac(const char* mac, size_t size=6);//на вход 6 байт
    uint32_t GetIP() const;
    void SetIP(uint32_t ip);
    char* GetMac() const;
    virtual ~MacIP();
};

#endif /* MACIP_HPP_ */
